class clusters::env inherits clusters {

  file { "/etc/profile.d/env.sh":
    mode       =>  '755',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/clusters/env/env.sh"
  }

  file { "/etc/profile.d/env.csh":
    mode       =>  '755',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/clusters/env/env.csh"
  }
  
  if $allowlimits { 
    file { "/etc/profile.d/limit.sh":
      ensure  => file,
      owner   => 0,
      group   => 0,
      mode    => '0755',
      content => template("${module_name}/limit.sh.erb"),
    }
    file { "/etc/profile.d/limit.csh":
      ensure  => file,
      owner   => 0,
      group   => 0,
      mode    => '0755',
      content => template("${module_name}/limit.csh.erb"),
    }
  }
  else {
    file { "/etc/profile.d/limit.sh":
      mode       =>  '755',
      owner      =>  'root',
      group      =>  'root',
      content    =>  "",
    }
    file { "/etc/profile.d/limit.csh":
      mode       =>  '755',
      owner      =>  'root',
      group      =>  'root',
      content    =>  "",
    }
  }
  file { "/etc/profile.d/rgma-hack.sh":
    mode       =>  '755',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/clusters/env/rgma-hack.sh"
  }
  file { "/etc/profile.d/rgma-hack.csh":
    mode       =>  '755',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/clusters/env/rgma-hack.csh"
  }

  if $operatingsystemrelease < "6.9" {
    $wnpkg="wn65pkg"
  }
  else {
    $wnpkg="wn69pkg"
  }
#  case $operatingsystemmajrelease {
#  '6': {
#    sysctl { "kernel.sysrq":
#      ensure => present,
#      value  => "1",
#    }
#         package { 'sl-release-notes-6.9-1.sl6.noarch':
#              provider => 'rpm',
#              ensure   => 'installed',
#              source   => "http://mirror.ihep.ac.cn/yum/scientific/6.9/x86_64/os/Packages/sl-release-notes-6.9-1.sl6.noarch.rpm",
#	      install_options => ['-U', '--force'],
#              require  => Yumrepo['site'],
#         }
#         package { 'sl-release-6.9-2.x86_64':
#              provider => 'rpm',
#              ensure   => 'installed',
#              source   => "http://mirror.ihep.ac.cn/yum/scientific/6.9/x86_64/os/Packages/sl-release-6.9-2.x86_64.rpm",
#              install_options => ['-U', '--force'],
#              require  => Yumrepo['site'],
#         }
#  }
#  '7': {
#    sysctl { "kernel.sysrq":
#      ensure => present,
#      value  => "1",
#      target => "/etc/sysctl.d/sysrq.conf",
#    }
#         package { 'sl-release-notes-7.5-1.sl7.noarch':
#              provider => 'rpm',
#              ensure   => 'installed',
#              source   => "http://mirror.ihep.ac.cn/yum/scientific/7.5/x86_64/os/Packages/sl-release-notes-7.5-1.sl7.noarch.rpm",
#              install_options => ['-U', '--force'],
#              require  => Yumrepo['site'],
#         }
#         package { 'sl-release-7.5-2.sl7.x86_64':
#              provider => 'rpm',
#              ensure   => 'installed',
#              source   => "http://mirror.ihep.ac.cn/yum/scientific/7.5/x86_64/os/Packages/sl-release-7.5-2.sl7.x86_64.rpm",
#              install_options => ['-U', '--force'],
#              require  => Yumrepo['site'],
#         }
#
#  }
#  }
}
